<?php

namespace App\Http\Controllers\Api\Web\Teacher;

use App\Http\Controllers\Common\ApiController;
use App\Http\Controllers\Controller;
use App\Models\Teacher\Teacher;
use App\Service\TeacherService;
use Illuminate\Http\Request;

class TeacherController extends ApiController {

    private $service;

    public function __construct() {
        $this->service = new TeacherService(Teacher::class);
    }

    public function lst(Request $request) {

        $page = $request->input('page',1);
        $pageSize = $request->input('pageSize',20);

        $conditions = ['status'=>1];
        $conditions['orderBy']['col'] ='is_top';
        $conditions['orderBy']['sort'] ='asc';
        $records = $this->service->lst($conditions)->paginate($pageSize,['*'],'page',$page);
        return responseSuccess($records->items(),$records->total());
    }

}
